#ifdef COMPILE_OPENGL
#include "COGL_ContextFactory.h"

#include <iostream>
#include "COGL_NAtive.h"

CB_SUBNAMESPACE_START(OpenGL)

CContextFactory::CContextFactory(CNativeHandle& _rHandle)
: m_pSystemContext(NULL)
{
	m_MainContext = CreateMainContext(_rHandle, m_pSystemContext);
    m_CurrentConfig = _rHandle;
}

// -------------------------------------------------------------------------------

void* CContextFactory::GetSystemContext()
{
    return m_pSystemContext;
}

// -------------------------------------------------------------------------------

CContextFactory::~CContextFactory()
{
}

// -------------------------------------------------------------------------------

RenderLib::CContextPtr& CContextFactory::CreateContext()
{
	static RenderLib::CContextPtr EmptyContext(NULL);
    
    Debug::Error("CContextFactory::CreateContext must never be called directly.");        
    return EmptyContext;
    
}

// -------------------------------------------------------------------------------

RenderLib::CContextPtr& CContextFactory::GetMainContext()
{
	return m_MainContext;
}

// -------------------------------------------------------------------------------

const RenderLib::IPlatformHandle& CContextFactory::GetCurrentConfig() const
{
    return m_CurrentConfig;
}

CB_SUBNAMESPACE_END
#endif